import { axios } from '@/utils/request'

const api = {
  supplier: '/suppliers'
}

export function getSupplierList (params) {
  return axios({
    url: api.supplier,
    method: 'get',
    responseType: params.hasOwnProperty('export') ? 'blob' : 'json', // 导出 下载
    params
  })
}

export function saveSupplier (params) {
  return axios({
    url: api.supplier + (params.hasOwnProperty('id') ? '/' + params.id : ''),
    method: params.hasOwnProperty('id') ? 'patch' : 'post',
    params
  })
}

export function getSupplierInfo (params) {
  return axios({
    url: api.supplier + '/' + params.id,
    method: 'get',
    params
  })
}
